# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-commentjson
pkgver=0.9.0
pkgrel=6
pkgdesc="Add Python and JavaScript style comments in your JSON files"
url="https://github.com/vaidik/commentjson"
license=('MIT')
arch=('any')
depends=('python-lark-parser')
makedepends=('python-setuptools')
checkdepends=('python-tests' 'python-six')
source=("$pkgname-$pkgver.tar.gz::https://github.com/vaidik/commentjson/archive/v$pkgver.tar.gz"
        $pkgname-rename-lark.patch::https://github.com/vaidik/commentjson/pull/52.patch)
sha512sums=('cd3d28adecbc445ed3faed7847c65a23829f408cf8aa3fa85544a0f0cf9fa5544b8aff560725cf51921f249123daf9ce9953069e99ca64a312bb4bff652512fe'
            'c00bce5471e912c7a2e0a4db2e96329dd4720b5f6813957bd5e0298ec5fe42ea362fcf0047b7a41e17aeab802bf36ef14e1b30826d87646c104f5f39002356ef')

prepare() {
  cd commentjson-$pkgver
  patch -p1 -i ../$pkgname-rename-lark.patch
}

build() {
  cd commentjson-$pkgver
  python setup.py build
}

check() {
  cd commentjson-$pkgver
  python setup.py test
}

package() {
  cd commentjson-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1

  install -Dm644 LICENSE.rst -t "$pkgdir"/usr/share/licenses/$pkgname/
}
